package FIT::Document::Handler::Base;

use FIT::Class;

sub handle {}

sub run_next_handler {
    my ($fixture, $element, @handlers) = @_;
    my $handler = shift @handlers;
    return unless $handler;
    $handler->handle($fixture, $element, @handlers);
}

sub make_fixture_state_key {
    my $name = shift;
    return ref($self). "::$name";
}

sub fixture_state {
    my ($state_name, $fixture, $value) = @_;
    my $key = $self->make_fixture_state_key($state_name);

    return $fixture->{$key} if @_ == 2;

    $fixture->{$key} = $value;
}

